package com.yanqu.road.server.cmd.activity.washe;

import com.yanqu.road.entity.activity.washe.data.WasheLastResultData;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.washe.WasheModule;
import com.yanqu.road.server.manger.activity.washe.WasheMgr;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_WASHE_SEE_GAME_OVER, desc = "")
public class WasheSeeGameOverCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        WasheLastResultData lastResultData = WasheMgr.getLastResultData(player.getUserId());
        if (lastResultData != null) {
            // 第一次看本次结果，触发下现金礼包
            if (!lastResultData.isRead()) {
                player.getModule(WasheModule.class).triggerRmbMall(lastResultData);
            }
            // 设置为已读
            lastResultData.setRead(true);
        }
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
